package cn.fl.project.controller;

import cmm.comm.facade.framework.api.ISysDictionaryApiService;
import cmm.comm.facade.framework.condition.SysCtrlCfgQueryCondition;
import cmm.comm.facade.framework.dto.SysDictionaryDTO;
import cmm.mid.core.framework.page.DataResultVO;
import cmm.mid.core.framework.page.KeyValueVO;
import cmm.mid.core.framework.page.ListPageVO;
import cmm.mid.core.framework.page.Pager;
import cmm.web.core.framework.controller.BaseController;
import cn.cmm.base.framework.constant.BaseConstant;
import cn.cmm.base.framework.constant.BaseExceptionConstant;
import cn.cmm.base.framework.exception.BaseException;
import cn.cmm.base.framework.logger.eum.LogExceptionEnum;
import cn.cmm.base.framework.logger.eum.LogOperEnum;
import cn.cmm.base.framework.utils.*;
import cn.fl.capital.condition.CapPayInfoQueryCondition;
import cn.fl.capital.service.ICapPayInfoService;
import cn.fl.capital.vo.CapPayInfoVO;
import cn.fl.framework.base.constant.WebBaseConstant;
import cn.fl.framework.base.context.CurrentThreadContext;
import cn.fl.framework.constant.DictionaryConstant;
import cn.fl.insroute.condition.InsRoutePrdInfoQC;
import cn.fl.insroute.service.IInsRouteBscInfoService;
import cn.fl.insroute.service.IInsRoutePrdInfoService;
import cn.fl.insroute.service.IInsRoutePrpsFeeService;
import cn.fl.insroute.vo.InsRouteBscInfoVO;
import cn.fl.insroute.vo.InsRoutePrdInfoVO;
import cn.fl.insroute.vo.InsRoutePrpsFeeVO;
import cn.fl.product.service.IPrdBscInfoService;
import cn.fl.product.service.ISplBankService;
import cn.fl.product.service.ISplInfoService;
import cn.fl.product.service.ISplRlPsnService;
import cn.fl.product.vo.*;
import cn.fl.project.api.IPrjPaySchMYqApiService;
import cn.fl.project.condition.PrjPaySchMYqQC;
import cn.fl.project.condition.PrjPrdBscInfoQueryCondition;
import cn.fl.project.condition.PrjPrdPaySchMQueryCondition;
import cn.fl.project.condition.PrjSplBankAccRQueryCondition;
import cn.fl.project.constant.*;
import cn.fl.project.dto.PrjCheckResultDTO;
import cn.fl.project.dto.PrjPaySchMYqDTO;
import cn.fl.project.service.*;
import cn.fl.project.vo.*;
import cn.fl.rebacc.web.service.ISaleRebAccInfoService;
import cn.fl.rebacc.web.vo.SaleRebAccInfoVO;
import cn.fl.system.constant.SysLogConstant;
import cn.fl.system.service.ISysCtrlCfgService;
import cn.fl.system.service.ISysUsrService;
import cn.fl.system.vo.SysCdMapDVO;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import fl.constant.facade.framework.constant.BusinessIdConstant;
import fl.flow.facade.flow.constant.FlowConstant;
import fl.product.facade.product.api.IProductApiService;
import fl.product.facade.product.condition.PrdBscInfoQueryCondition;
import fl.product.facade.product.constant.ProductConstant;
import fl.product.facade.product.dto.PrdBscInfoDTO;
import fl.riskctrl.facade.riskctrl.dto.RcCstBscInfoDTO;
import fl.spl.facade.framework.constant.SplSystemConstant;
import fl.spl.facade.framework.enums.common.MagicNumReplaceEnum;
import fl.spl.facade.lnkcomp.condition.PrjLnkCompQueryCondition;
import fl.spl.facade.lnkcomp.constant.PrjLnkCompRelInfoConstant;
import fl.spl.facade.rebacc.condition.SaleRebAccInfoQC;
import fl.spl.facade.spl.condition.SplBankQueryCondition;
import fl.spl.facade.spl.condition.SplInfoQueryCondition;
import fl.spl.facade.spl.condition.SplRlPsnQueryCondition;
import fl.spl.facade.store.api.ISplPropInfoApiService;
import net.sf.json.JSONArray;
import org.apache.commons.collections.MapUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @Description: 项目产品基础信息表 控制层
 */
@Controller
@RequestMapping("/project/prjprdbscinfo")
public class PrjPrdBscInfoController extends BaseController {

	private static final Logger logger = LoggerFactory.getLogger(PrjPrdBscInfoController.class);

	/**
	 * PrjPrdBscInfo 服务层BEAN
	 */
	@Autowired
	private IPrjPrdBscInfoService prjPrdBscInfoService;
	
	@Autowired
	private IPrdBscInfoService prdBscInfoService;
	/**
	 * PrjBscInfo 服务层BEAN
	 */
	@Autowired
	private IPrjBscInfoService prjBscInfoService;
	
	@Autowired
	private ISysCtrlCfgService sysCtrlCfgService;
	
	@Autowired
	private IPrjQuatPrpsCfgMService prjQuatPrpsCfgMService;

	/**
	 * 查询供应商账号的供应商返利账号的服务
	 */
	@Autowired
	private ISplBankService splBankService;

	/**
	 * 产品明细 服务层BEAN
	 */
	@Autowired
	private IPrjPrdPaySchMService prjPrdPaySchMService;
	/**
	 * 本地数据字典服务
	 */
	@Autowired
	private ISysDictionaryApiService sysDictionaryApiService;

	/**
	 * 供应商返利账号
	 */
	@Autowired
	private IPrjSplBankAccRService prjSplBankAccRService;
	/**
	 * 供应商返利账号
	 */
	@Autowired
	private IProductApiService productApiService;

	@Autowired
	private ISaleRebAccInfoService saleRebAccInfoService;

	@Autowired
    private ISysUsrService sysUsrService;

    @Autowired
    private IInsRoutePrdInfoService insRoutePrdInfoService;

	@Autowired
	private IInsRouteBscInfoService insRouteBscInfoService;

	@Autowired
	private IInsRoutePrpsFeeService insRoutePrpsFeeService;

	@Autowired
	private IPrjPaySchMYqApiService prjPaySchMYqApiService;

	@Autowired
	private ICapPayInfoService capPayInfoService;//付款信息表

	@Autowired
	private ISplRlPsnService splRlPsnService;

	@Autowired
	private ISplPropInfoApiService iSplPropInfoApiService;

	@Autowired
	private IPrjLnkCompService prjLnkCompService;

	@Autowired
	private ISplInfoService prdSplInfoService;

	/**
	 * 到列表页面
	 */
	@RequestMapping(value = "/toListPage.do", method = { RequestMethod.GET})
	public ModelAndView toListPage(HttpServletRequest request, HttpServletResponse response) {
		ModelAndView view = new ModelAndView("project/prjPrdBscInfo/list");
		BaseLogUtils.info(logger, "toListPage", "跳转到列表页面.", CurrentThreadContext.getCurrentUserName());
		return view;
	}

	/**
	 * 到修改页面
	 */
	@RequestMapping(value = "/toModifyPage.do", method = { RequestMethod.GET, RequestMethod.POST })
	public ModelAndView toModifyPage(HttpServletRequest request, HttpServletResponse response) {
		String id = request.getParameter("id");
		String prdDetailId = request.getParameter("id");
		String prjId = request.getParameter("prjId");
		String detailFlag = request.getParameter("detailFlag");
		ModelAndView view = new ModelAndView("project/prjprdbscinfo/projectPrdInfoAdd");
		//获取项目基础及明细信息
		PrjPrdBscInfoVO prdBscInfoVO = this.prjPrdBscInfoService.getPrjPrdBscInfoById(Long.valueOf(id));
		List<KeyValueVO> yesNoCdList = this.prjQuatPrpsCfgMService.searchYesOrNoCdList();
		List<KeyValueVO> vehCheckCdList = this.prjQuatPrpsCfgMService.searchVehCheckCdList();
		boolean tkFlag = false;
		if(!(prdBscInfoVO.getPrdTypCd().equals(ProductConstant.PRD_BUS_CD)||prdBscInfoVO.getPrdTypCd().equals(ProductConstant.PRD_CAR_CD))){
			tkFlag = true;//卡车查询挂靠公司信息
		}
		
		PrjBscInfoVO bscVo = this.prjBscInfoService.selectById(Long.valueOf(prjId));
		
		Long accId = null;//供应商账号id
		String accNo = "";//供应商账号
		Long backAccId = null;//供应商返利id
		String backAccNo="";// 供应商账号
		Integer hasSplBackNo = BaseConstant.IS_YESNO_NO;
		List<Long> accNoIdList = new ArrayList<Long>();
		PrjSplBankAccRQueryCondition accQc = new PrjSplBankAccRQueryCondition();
		accQc.setPrjPrdId(Long.valueOf(id));
		List<PrjSplBankAccRVO> splBankAccRVOList = 	this.prjSplBankAccRService.searchList(accQc);
		if(CollectionUtils.isNotEmpty(splBankAccRVOList)){
			for (PrjSplBankAccRVO prjSplBankAccRVO : splBankAccRVOList) {
				accNoIdList.add(prjSplBankAccRVO.getSplAccNoId());
				if(prjSplBankAccRVO.getPurpCd().equals(PrjPrdBscInfoConstant.SPL_BANK_NO_TP)){
					accId = prjSplBankAccRVO.getSplAccNoId();
				}
				if(prjSplBankAccRVO.getPurpCd().equals(PrjPrdBscInfoConstant.SPL_BACK_BANK_NO_TYP)){
					backAccId = prjSplBankAccRVO.getSplAccNoId();
					hasSplBackNo = BaseConstant.IS_YESNO_YES;
				}
			}
		}
		if(CollectionUtils.isNotEmpty(accNoIdList)){
			Pager page = new Pager();
				page.setCurrentPage(1);
				page.setEveryPage(Integer.MAX_VALUE);
			SplBankQueryCondition qc = new SplBankQueryCondition();
			qc.setIdList(accNoIdList);
			page.setCondition(qc);
			
			Pager pager= 	 this.splBankService.searchListPage(page);
			List<SplBankVO> list = (List<SplBankVO>) pager.getResultList();
			if(CollectionUtils.isNotEmpty(list)){
				for (SplBankVO splBankVO : list) {
					if(null!=accId&&splBankVO.getId().equals(accId.longValue())){
						accNo = splBankVO.getAccNo();
					}
					if(null!=backAccId&&splBankVO.getId().equals(backAccId.longValue())){
							backAccNo = splBankVO.getAccNo();
					}
				}
			}
		}
		//品牌类别
		List<KeyValueVO> brTypCdList  =  this.prjBscInfoService.getBrTypCdList();
		//产品种类
		List<KeyValueVO> prdClsCdList = this.prjBscInfoService.getPrdClsCdList();
		//保险购买方式
		List<KeyValueVO> buyWayCdList = this.prjBscInfoService.getBuyWayCdList();
		//产品计量单位类型
		List<KeyValueVO> prdUntCdList = this.prjBscInfoService.getPrdUntList();
		//产品计量单位类型
		List<KeyValueVO> licenseCdList = this.prjBscInfoService.getLicenseCdList();
		
		SysCdMapDVO plcyMap = this.prjPrdBscInfoService.searchPlcyMapByPrdCd(prdBscInfoVO.getPrdTypCd());

		view.addObject("id", id);
		view.addObject("prdBscInfoVO", prdBscInfoVO);
		view.addObject("yesNoCdList",yesNoCdList);
		view.addObject("vehCheckCdList",vehCheckCdList);
		view.addObject("modifyFlag",true);
		view.addObject("prdDetailId", prdDetailId);
		view.addObject("plcyTcode", null==plcyMap?"":plcyMap.getTCode());
		view.addObject("prdUntCdList",prdUntCdList );
		view.addObject("prdCd", prdBscInfoVO.getPrdCd());
		view.addObject("prdTypCd", prdBscInfoVO.getPrdTypCd());
		view.addObject("bizTypCd", prdBscInfoVO.getBizTypCd());
		String bizCd = prdBscInfoVO.getBizCd();
		view.addObject("bizCd", bizCd);
		if(StringUtils.isNotBlank(bizCd)){
			view.addObject("bizCdFir", bizCd.substring(0, 3));
		}
		view.addObject("prjId", prjId);
		view.addObject("tkFlag", tkFlag);
		view.addObject("splId", prdBscInfoVO.getSplId());
		view.addObject("splNm", prdBscInfoVO.getSplNm());
		view.addObject("licenseCdList", licenseCdList);
		view.addObject("splMfrId", prdBscInfoVO.getSplMfrId());
		view.addObject("splMfrNm", prdBscInfoVO.getSplMfrNm());
		
		view.addObject("splBanNo", prdBscInfoVO.getSplAccNoId());
		view.addObject("detailFlag", detailFlag);
		view.addObject("brTypCdList", brTypCdList);
		view.addObject("buyWayCdList", buyWayCdList);
		view.addObject("prdClsCdList", prdClsCdList);
		view.addObject("buOrgCd", bscVo.getBuOrgCd());
		view.addObject("prjTypCd", bscVo.getPrjTypCd());
		view.addObject("isSplMfr", bscVo.getIsSplMfr());
		view.addObject("accId", accId);
		view.addObject("accNo", accNo);
		view.addObject("backAccId", backAccId);
		view.addObject("backAccNo", backAccNo);
		view.addObject("hasSplBackNo", hasSplBackNo);
		/*if(splBankVO!=null){
			view.addObject("accNo", splBankVO.getAccNo());
		}else{
			view.addObject("accNo", null);
		}*/
		BaseLogUtils.info(logger, "toModifyPage", "跳转到修改页面.[id="+id+"]", CurrentThreadContext.getCurrentUserName());
		return view;
	}


	/**
	 * 到修改工行项目产品页面(运维专用)
	 */
	@RequestMapping(value = "/toPrjPrdGHModifyPage4Sys.do", method = { RequestMethod.GET, RequestMethod.POST })
	public ModelAndView toPrjPrdGHModifyPage4Sys(HttpServletRequest request, HttpServletResponse response) {
		String id = request.getParameter("id");
		String prjId = request.getParameter("prjId");
		String detailFlag = request.getParameter("detailFlag");
		ModelAndView view = new ModelAndView("project/prjprdbscinfo/projectPrdInfoGHAdd4Sys");
		Map<String, String> prdTypCdMap = this.sysDictionaryApiService.searchGroupToMap(CurrentThreadContext.getCurrentSysCd(), CurrentThreadContext.getCurrentOrgCd(), DictionaryConstant.CODE_PRD_TYE_CD);
		//获取项目基础及明细信息
		PrjPrdBscInfoVO prdBscInfoVO = this.prjPrdBscInfoService.selectPrjPrdBscAndDetailInfoById(id);
		//产品类型
		if(prdTypCdMap.containsKey(prdBscInfoVO.getPrdTypCd())){
			prdBscInfoVO.setPrdTypCdNm(prdTypCdMap.get(prdBscInfoVO.getPrdTypCd()));
		}
		List<KeyValueVO> yesNoCdList = this.prjQuatPrpsCfgMService.searchYesOrNoCdList();
		List<KeyValueVO> vehCheckCdList = this.prjQuatPrpsCfgMService.searchVehCheckCdList();

		PrjBscInfoVO bscVo = this.prjBscInfoService.selectById(Long.valueOf(prjId));

		Long accId = null;//供应商账号id
		String accNo = "";//供应商账号
		Long backAccId = null;//供应商返利id
		String backAccNo="";// 供应商账号
		Integer hasSplBackNo = BaseConstant.IS_YESNO_NO;
		List<Long> accNoIdList = new ArrayList<Long>();
		PrjSplBankAccRQueryCondition accQc = new PrjSplBankAccRQueryCondition();
		accQc.setPrjPrdId(Long.valueOf(id));
		List<PrjSplBankAccRVO> splBankAccRVOList = 	this.prjSplBankAccRService.searchList(accQc);
		if(CollectionUtils.isNotEmpty(splBankAccRVOList)){
			for (PrjSplBankAccRVO prjSplBankAccRVO : splBankAccRVOList) {
				accNoIdList.add(prjSplBankAccRVO.getSplAccNoId());
				if(prjSplBankAccRVO.getPurpCd().equals(PrjPrdBscInfoConstant.SPL_BANK_NO_TP)){
					accId = prjSplBankAccRVO.getSplAccNoId();
				}
				if(prjSplBankAccRVO.getPurpCd().equals(PrjPrdBscInfoConstant.SPL_BACK_BANK_NO_TYP)){
					backAccId = prjSplBankAccRVO.getSplAccNoId();
					hasSplBackNo = BaseConstant.IS_YESNO_YES;
				}
			}
		}
		if(CollectionUtils.isNotEmpty(accNoIdList)){
			Pager page = new Pager();
			page.setCurrentPage(1);
			page.setEveryPage(Integer.MAX_VALUE);
			SplBankQueryCondition qc = new SplBankQueryCondition();
			qc.setIdList(accNoIdList);
			page.setCondition(qc);

			Pager pager= 	 this.splBankService.searchListPage(page);
			List<SplBankVO> list = (List<SplBankVO>) pager.getResultList();
			if(CollectionUtils.isNotEmpty(list)){
				for (SplBankVO splBankVO : list) {
					if(null!=accId&&splBankVO.getId().equals(accId.longValue())){
						accNo = splBankVO.getAccNo();
					}
					if(null!=backAccId&&splBankVO.getId().equals(backAccId.longValue())){
						backAccNo = splBankVO.getAccNo();
					}
				}
			}
		}
		view.addObject("id", id);

		view.addObject("prdBscInfoVO", JSON.toJSONString(prdBscInfoVO));
		view.addObject("yesNoCdList",yesNoCdList);
		view.addObject("vehCheckCdList",vehCheckCdList);
		view.addObject("modifyFlag",true);
		view.addObject("prjId", prjId);
		view.addObject("splId", prdBscInfoVO.getSplId());
		view.addObject("splNm", prdBscInfoVO.getSplNm());

		view.addObject("splMfrId", prdBscInfoVO.getSplMfrId());
		view.addObject("splMfrNm", prdBscInfoVO.getSplMfrNm());

		view.addObject("splBanNo", prdBscInfoVO.getSplAccNoId());
		view.addObject("detailFlag", detailFlag);
		view.addObject("buOrgCd", bscVo.getBuOrgCd());
		view.addObject("prjTypCd", bscVo.getPrjTypCd());
		view.addObject("accId", accId);
		view.addObject("accNo", accNo);
		view.addObject("backAccId", backAccId);
		view.addObject("backAccNo", backAccNo);
		view.addObject("hasSplBackNo", hasSplBackNo);
		BaseLogUtils.info(logger, "toModifyPage", "跳转到修改页面.[id="+id+"]", CurrentThreadContext.getCurrentUserName());
		return view;
	}
	
	
	/**
	 * 到添加工行项目产品页面
	 */
	@RequestMapping(value = "/toPrjPrdGHAddPage.do", method = { RequestMethod.GET, RequestMethod.POST })
	public ModelAndView toPrjPrdGHAddPage(HttpServletRequest request, HttpServletResponse response) {
		String prjId = request.getParameter("prjId");
		//查询默认的工行产品
		PrdBscInfoQueryCondition prdQc = new PrdBscInfoQueryCondition();
		prdQc.setPrdTypCd(PrjPrdBscInfoConstant.PRJ_PRD_TYP_GH);
		List<PrdBscInfoDTO> prjdBscInfoList = 	this.productApiService.searchPrdBscInfoList(prdQc,CurrentThreadContext.getCurrentSysCd(),CurrentThreadContext.getCurrentOrgCd());
		PrdBscInfoDTO prdBscInfoDTO = null;
		if(CollectionUtils.isNotEmpty(prjdBscInfoList)){
			prdBscInfoDTO = prjdBscInfoList.get(0);
		}
		ModelAndView view = new ModelAndView("project/prjprdbscinfo/projectPrdInfoGHAdd");
		BaseLogUtils.info(logger, "toModifyPage", "跳转到修改页面.[prjId="+prjId+"]", CurrentThreadContext.getCurrentUserName());
		view.addObject("prdBscInfo", prdBscInfoDTO);
		view.addObject("prjId", prjId);
		return view;
	}
	
	/**
	 * 到修改工行项目产品页面
	 */
	@RequestMapping(value = "/toPrjPrdGHModifyPage.do", method = { RequestMethod.GET, RequestMethod.POST })
	public ModelAndView toPrjPrdGHModifyPage(HttpServletRequest request, HttpServletResponse response) {
		String id = request.getParameter("id");
		String prjId = request.getParameter("prjId");
		String detailFlag = request.getParameter("detailFlag");
		ModelAndView view = new ModelAndView("project/prjprdbscinfo/projectPrdInfoGHAdd");
		Map<String, String> prdTypCdMap = this.sysDictionaryApiService.searchGroupToMap(CurrentThreadContext.getCurrentSysCd(), CurrentThreadContext.getCurrentOrgCd(), DictionaryConstant.CODE_PRD_TYE_CD);
		//获取项目基础及明细信息
		PrjPrdBscInfoVO prdBscInfoVO = this.prjPrdBscInfoService.selectPrjPrdBscAndDetailInfoById(id);
		//产品类型
		if(prdTypCdMap.containsKey(prdBscInfoVO.getPrdTypCd())){
			prdBscInfoVO.setPrdTypCdNm(prdTypCdMap.get(prdBscInfoVO.getPrdTypCd()));
		}
		List<KeyValueVO> yesNoCdList = this.prjQuatPrpsCfgMService.searchYesOrNoCdList();
		List<KeyValueVO> vehCheckCdList = this.prjQuatPrpsCfgMService.searchVehCheckCdList();
		
		PrjBscInfoVO bscVo = this.prjBscInfoService.selectById(Long.valueOf(prjId));
		
		Long accId = null;//供应商账号id
		String accNo = "";//供应商账号
		Long backAccId = null;//供应商返利id
		String backAccNo="";// 供应商账号
		Integer hasSplBackNo = BaseConstant.IS_YESNO_NO;
		List<Long> accNoIdList = new ArrayList<Long>();
		PrjSplBankAccRQueryCondition accQc = new PrjSplBankAccRQueryCondition();
		accQc.setPrjPrdId(Long.valueOf(id));
		List<PrjSplBankAccRVO> splBankAccRVOList = 	this.prjSplBankAccRService.searchList(accQc);
		if(CollectionUtils.isNotEmpty(splBankAccRVOList)){
			for (PrjSplBankAccRVO prjSplBankAccRVO : splBankAccRVOList) {
				accNoIdList.add(prjSplBankAccRVO.getSplAccNoId());
				if(prjSplBankAccRVO.getPurpCd().equals(PrjPrdBscInfoConstant.SPL_BANK_NO_TP)){
					accId = prjSplBankAccRVO.getSplAccNoId();
				}
				if(prjSplBankAccRVO.getPurpCd().equals(PrjPrdBscInfoConstant.SPL_BACK_BANK_NO_TYP)){
					backAccId = prjSplBankAccRVO.getSplAccNoId();
					hasSplBackNo = BaseConstant.IS_YESNO_YES;
				}
			}
		}
		if(CollectionUtils.isNotEmpty(accNoIdList)){
			Pager page = new Pager();
				page.setCurrentPage(1);
				page.setEveryPage(Integer.MAX_VALUE);
			SplBankQueryCondition qc = new SplBankQueryCondition();
			qc.setIdList(accNoIdList);
			page.setCondition(qc);
			
			Pager pager= 	 this.splBankService.searchListPage(page);
			List<SplBankVO> list = (List<SplBankVO>) pager.getResultList();
			if(CollectionUtils.isNotEmpty(list)){
				for (SplBankVO splBankVO : list) {
					if(null!=accId&&splBankVO.getId().equals(accId.longValue())){
						accNo = splBankVO.getAccNo();
					}
					if(null!=backAccId&&splBankVO.getId().equals(backAccId.longValue())){
							backAccNo = splBankVO.getAccNo();
					}
				}
			}
		}
		view.addObject("id", id);
		
		view.addObject("prdBscInfoVO", JSON.toJSONString(prdBscInfoVO));
		view.addObject("yesNoCdList",yesNoCdList);
		view.addObject("vehCheckCdList",vehCheckCdList);
		view.addObject("modifyFlag",true);
		view.addObject("prjId", prjId);
		view.addObject("splId", prdBscInfoVO.getSplId());
		view.addObject("splNm", prdBscInfoVO.getSplNm());
		
		view.addObject("splMfrId", prdBscInfoVO.getSplMfrId());
		view.addObject("splMfrNm", prdBscInfoVO.getSplMfrNm());
		
		view.addObject("splBanNo", prdBscInfoVO.getSplAccNoId());
		view.addObject("detailFlag", detailFlag);
		view.addObject("buOrgCd", bscVo.getBuOrgCd());
		view.addObject("prjTypCd", bscVo.getPrjTypCd());
		view.addObject("accId", accId);
		view.addObject("accNo", accNo);
		view.addObject("backAccId", backAccId);
		view.addObject("backAccNo", backAccNo);
		view.addObject("hasSplBackNo", hasSplBackNo);
		BaseLogUtils.info(logger, "toModifyPage", "跳转到修改页面.[id="+id+"]", CurrentThreadContext.getCurrentUserName());
		return view;
	}
	
	
	/**
	 * 
	 * 检查拆分产品里是否包含删除、修改的产品信息
	 * @param request
	 * @return
	 * @throws Exception
	 */
	@RequestMapping(value = "/checkPrjPrdDtlExist.do", method = { RequestMethod.GET})
	@ResponseBody
	public Object checkPrjPrdDtlExist(HttpServletRequest request, HttpServletResponse response) throws BaseException {
		String prjId = request.getParameter("prjId");
		String ids = request.getParameter("ids");
		DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES, "获取成功");
		try {
			boolean existFlag = false;
			//查询是否有支付表信息
			PrjPrdPaySchMQueryCondition qc = new PrjPrdPaySchMQueryCondition();
			qc.setPrjId(Long.valueOf(prjId));
            qc.setPaySchTypCd(PrjPrdPaySchMConstant.PAY_SCH_TYP_CD_WS);
			List<PrjPrdPaySchMVO> prjQuatList = this.prjPrdPaySchMService.searchList(qc);
			if(CollectionUtils.isNotEmpty(prjQuatList)){
				existFlag = true;
			}
			result.setData(existFlag);
		}catch(BaseException ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(ex.getMessage());
			logger.error(ex.getMessage(), ex);
		}catch(Exception ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo("获取数据失败！");
			logger.error("获取数据失败！", ex);
		}
		return result;
	}

	/**
	 * 根据供应商ID和审核状态查询供应商账号信息
	 *
	 * @param request
	 * @return
	 * @throws Exception
	 */
	@RequestMapping(value = "/getSplBankAccNoBySplId.do", method = { RequestMethod.GET})
	@ResponseBody
	public Object getSplBankAccNoBySplId(HttpServletRequest request, HttpServletResponse response) throws BaseException {
		String splId = request.getParameter("splId");//供应商ID
		String purpCd = request.getParameter("purpCd");//供应商用途
		String audStsCdStr = request.getParameter("audStsCdList");
		String rcptUnt = request.getParameter("rcptUnt");// 收款单位（人）
		String currentPage = request.getParameter("page");
		String pageSize = request.getParameter("pagesize");
		String accNo = request.getParameter("accNo");
		String compensatoryType = request.getParameter("compensatoryType");
		DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES, "获取成功");
		ListPageVO<SplBankVO> listPage = null;
		Pager pager = new Pager();
		try {
			//查询供应商账号信息
			if(StringUtils.isBlank(splId)){
				result.setSuccess(BaseConstant.IS_YESNO_NO);
				result.setInfo("供应商ID为空！");
				return result;
			}
			SplBankQueryCondition qc = new SplBankQueryCondition();
			qc.setSplId(Long.valueOf(splId));
			if(StringUtils.isNotBlank(purpCd)){
				qc.setPurpCd(purpCd);
			}else{
				qc.setPurpCd(PrjPrdBscInfoConstant.SPL_BANK_NO_TP);
			}
			if (StringUtils.isNotEmpty(rcptUnt)) {
				qc.setRcptUnt(rcptUnt);
			}
			if (StringUtils.isNotEmpty(accNo)) {
				qc.setAccNo(accNo);
			}
			List<String> audStsCdList = new ArrayList<String>();
			JSONArray audStsArray = JSONArray.fromObject(audStsCdStr);
			for (Object object : audStsArray) {
				audStsCdList.add(object.toString());
			}
			if(StringUtils.isNotBlank(compensatoryType) && "1".equals(compensatoryType)){
				qc.setIsSelectGuar(1);
			}
			qc.setAudStsCdList(audStsCdList);
			if (StringUtils.isNotEmpty(currentPage)) {
				pager.setCurrentPage(Integer.parseInt(currentPage));
			} else {
				pager.setCurrentPage(1);
			}

			if (StringUtils.isNotEmpty(pageSize)) {
				pager.setEveryPage(Integer.parseInt(pageSize));
			} else {
				pager.setEveryPage(10);
			}
			pager.setCondition(qc);
            pager.setEveryPage(50);
            pager = this.splBankService.searchListPage(pager);
            List<SplBankVO> splBankList = (List<SplBankVO>) pager.getResultList();
			if(CollectionUtils.isEmpty(splBankList)){
				result.setSuccess(BaseConstant.IS_YESNO_NO);
				result.setInfo("数据不存在！");
				splBankList = new ArrayList<>();
			}
			listPage = new ListPageVO<SplBankVO>((List<SplBankVO>) splBankList, pager.getTotalCount());
			result.setData(splBankList);
		}catch(BaseException ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(ex.getMessage());
			logger.error(ex.getMessage(), ex);
		}catch(Exception ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo("获取数据失败！");
			logger.error("获取数据失败！", ex);
		}
 		return listPage;
	}

	/**
	 * 查询担保渠道主体列表
	 */
	@SuppressWarnings("unchecked")
	@RequestMapping(value = "/queryGuaranteeChannelList.do", method = { RequestMethod.GET,RequestMethod.POST})
	@ResponseBody
	public Object queryGuaranteeChannelList(HttpServletRequest request, HttpServletResponse response) {
		String currentPage = request.getParameter("page");
		String pageSize = request.getParameter("pagesize");

		String guaranteePaymentType = request.getParameter("guaranteePaymentType");
		String compensatoryType = request.getParameter("compensatoryType");
		if(StringUtils.isBlank(guaranteePaymentType)){
			String condition = request.getParameter("condition");
			if(StringUtils.isNotBlank(condition)){
				com.alibaba.fastjson.JSONArray jsonArray = JSON.parseArray(condition);
				for (Object o : jsonArray) {
					JSONObject jsonObject = (JSONObject)o;
					if(jsonObject.getString("field").equals("guaranteePaymentType")){
						guaranteePaymentType = jsonObject.getString("value");
					}
					if(jsonObject.getString("field").equals("compensatoryType")){
						compensatoryType = jsonObject.getString("value");
					}
				}
			}
		}
		String guaranteePaymentNm = request.getParameter("guaranteePaymentNm");

		Pager page = new Pager();
		if (StringUtils.isNotEmpty(currentPage)) {
			page.setCurrentPage(Integer.parseInt(currentPage));
		}
		if (StringUtils.isNotEmpty(pageSize)) {
			page.setEveryPage(Integer.parseInt(pageSize));
		}
		com.alibaba.fastjson.JSONArray resultArray = new com.alibaba.fastjson.JSONArray();
		Pager pager = null;
		if("1".equals(guaranteePaymentType)){
			//查询供应商列表
			SplInfoQueryCondition qc = new SplInfoQueryCondition();
			if(StringUtils.isNotBlank(guaranteePaymentNm)){
				qc.setSplNm(guaranteePaymentNm);
			}
			qc.setIsDel(BaseConstant.IS_YESNO_NO);
			qc.setIsBlackList(MagicNumReplaceEnum.REP_IGNORE_VAL.getVal());
			if("1".equals(compensatoryType)){
				qc.setGuarCd("9");
				qc.setCompEffectIsValid(1);
			}
			if("2".equals(compensatoryType)){
				qc.setGuarCd("8");
			}
			List<String> audStsCdList = new ArrayList<>();
			/*audStsCdList.add(FlowConstant.FLOW_CHECK_STATE_PASS);
			qc.setAudStsCdList(audStsCdList);*/
			qc.setAudStsCd(FlowConstant.FLOW_CHECK_STATE_PASS);
			page.setCondition(qc);
			pager = this.prdSplInfoService.searchListPage(page);
			List<SplInfoVO> list = (List<SplInfoVO>) pager.getResultList();
			for (SplInfoVO splInfoVO : list) {
				JSONObject resultObj = new JSONObject();
				resultObj.put("guaranteePaymentId", splInfoVO.getId());//供应商ID
				resultObj.put("guaranteePaymentNm", splInfoVO.getSplNm());//供应商名称
				resultArray.add(resultObj);
			}
		}else{
			PrjLnkCompQueryCondition qc = new PrjLnkCompQueryCondition();
			if(StringUtils.isNotBlank(guaranteePaymentNm)){
				qc.setLnkCompNm(guaranteePaymentNm);
			}
			if("1".equals(compensatoryType)){
				qc.setGuarCd("9");
				qc.setCompEffectIsValid(1);
			}
			if("2".equals(compensatoryType)){
				qc.setGuarCd("8");
			}
			List<String> audStsCdList = new ArrayList<>();
			audStsCdList.add(FlowConstant.FLOW_CHECK_STATE_PASS);
			qc.setAudStsCdList(audStsCdList);
			qc.setIsBlackList(BaseConstant.IS_YESNO_NO);
			qc.setIsDel(BaseConstant.IS_YESNO_NO);
			page.setCondition(qc);
			//查询挂靠公司列表
			pager = this.prjLnkCompService.searchListPage(page);
			List<PrjLnkCompVO> list = (List<PrjLnkCompVO>)pager.getResultList();
			if(CollectionUtils.isNotEmpty(list)){
				for (PrjLnkCompVO prjLnkCompVO : list) {
					JSONObject jsonObject = new JSONObject();
					jsonObject.put("guaranteePaymentId",prjLnkCompVO.getId());
					jsonObject.put("guaranteePaymentNm",prjLnkCompVO.getLnkCompNm());
					resultArray.add(jsonObject);
				}
			}
		}
		ListPageVO listPage = new ListPageVO<>(resultArray, pager.getTotalCount());
		BaseLogUtils.newWebLogger("查询担保渠道主体列表").setLogOperType(LogOperEnum.RESP)
				.setSysCd(CurrentThreadContext.getCurrentSysCd())
				.setChannelCd(SplSystemConstant.KCRZ_HELPER_APP_CHL_CD)
				.setBussinessId(BusinessIdConstant.LOG_SPL_MANAGER_CD)
				.setWarning(false)
				.setKeys("resultPage", JSON.toJSONString(listPage))
				.info();
		return listPage;
	}

	/**
	 * 销售返利账号
	 * @param request
	 * @return
	 * @throws Exception
	 */
	@RequestMapping(value = "/getSalBackBankNo.do", method = { RequestMethod.GET})
	@ResponseBody
	public Object getSalBackBankNo(HttpServletRequest request, HttpServletResponse response) throws BaseException {
	    String prjId = request.getParameter("prjId");
		String audStsCdStr = request.getParameter("audStsCdList");
		DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES, "获取成功");
		ListPageVO<SaleRebAccInfoVO> listPage = null;
		SaleRebAccInfoQC condition = new SaleRebAccInfoQC();
		PrjBscInfoVO prjBscInfoVO = prjBscInfoService.selectById(Long.parseLong(prjId));
		try {
			//查询供应商账号信息

			List<String> audStsCdList = new ArrayList<String>();
			JSONArray audStsArray = JSONArray.fromObject(audStsCdStr);
			for (Object object : audStsArray) {
				audStsCdList.add(object.toString());
			}
			condition.setOrgCd(prjBscInfoVO.getCstMgrOrgCd());
			condition.setAudStsCdList(audStsCdList);
			List<SaleRebAccInfoVO> saleRebAccInfoVOList = saleRebAccInfoService.searchList(condition);
			// List<SplBankVO> splBankList = this.prjPrdBscInfoService.getSplBankAccNoBySplId(qc);
			if(CollectionUtils.isEmpty(saleRebAccInfoVOList)){
				result.setSuccess(BaseConstant.IS_YESNO_NO);
				result.setInfo("数据不存在！");
			}
			listPage = new ListPageVO<SaleRebAccInfoVO>((List<SaleRebAccInfoVO>) saleRebAccInfoVOList, saleRebAccInfoVOList.size());
			result.setData(saleRebAccInfoVOList);
		}catch(BaseException ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(ex.getMessage());
			logger.error(ex.getMessage(), ex);
		}catch(Exception ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo("获取数据失败！");
			logger.error("获取数据失败！", ex);
		}
		return listPage;
	}
	
	
	/**
	 * 初始化列表
	 */
	@SuppressWarnings("unchecked")
	@RequestMapping(value = "/splInitList.do", method = { RequestMethod.GET})
	@ResponseBody
	public Object splInitList(HttpServletRequest request, HttpServletResponse response) {
		String currentPage = request.getParameter("page");
		String pageSize = request.getParameter("pagesize");
		String audStsCdStr = request.getParameter("audStsCdList");
		String condition = request.getParameter("condition");
		String prjId = request.getParameter("prjId");
		String isQueryCompensatoryInfo = request.getParameter("isQueryCompensatoryInfo");
		Pager page = new Pager();
		if (StringUtils.isNotEmpty(currentPage)) {
			page.setCurrentPage(Integer.parseInt(currentPage));
		}

		if (StringUtils.isNotEmpty(currentPage)) {
			page.setEveryPage(Integer.parseInt(pageSize));
		}
	
		String value = "";
		if(StringUtils.isNotBlank(condition)){
			String con = condition.substring(1, condition.length()-1);
			if(StringUtils.isNotBlank(con)){
				net.sf.json.JSONObject fromObject = net.sf.json.JSONObject.fromObject(con);
				value = (String) fromObject.get("value");
			}
		}
		SplInfoQueryCondition qc = new SplInfoQueryCondition();
		List<String> audStsCdList = new ArrayList<String>();
		JSONArray audStsArray = JSONArray.fromObject(audStsCdStr);
		for (Object object : audStsArray) {
			audStsCdList.add(object.toString());
		}
		qc.setAudStsCdList(audStsCdList);
		if(StringUtils.isNotBlank(isQueryCompensatoryInfo)){
			qc.setIsSelectGuar(1);
		}
		
/*		String currentBuOrgCd = CurrentThreadContext.getCurrentBuOrgCd();
		Map<String, String> buOrgCdMap = this.sysDictionaryApiService.searchGroupToMap(CurrentThreadContext.getCurrentSysCd(), CurrentThreadContext.getCurrentOrgCd(), DictionaryConstant.CODE_SYS_BU_ORG_CD);
		if(buOrgCdMap.containsKey(currentBuOrgCd)){
			qc.setBuOrgCd(CurrentThreadContext.getCurrentBuOrgCd());
		}*/
		List<Long> splIds = new ArrayList<>();
		Map<Long, RcCstBscInfoDTO> map = new HashMap<>();
		String isBigCstWork = BaseConstant.IS_YESNO_NO_STR;
		if(StringUtils.isNotEmpty(prjId)){
			PrjBscInfoVO prjBscInfoVO = this.prjBscInfoService.selectById(Long.valueOf(prjId));
			if(prjBscInfoVO != null){
				if(StringUtils.isNotBlank(prjBscInfoVO.getIsBigCstWork())){
					isBigCstWork = prjBscInfoVO.getIsBigCstWork();
				}
			}
			PrjCheckResultDTO dto = this.prjBscInfoService.checkCreditRule(prjId);
			BaseLogUtils.info(logger,"splInitList","项目产品.经销商列表PrjCheckResult=" + JSON.toJSONString(dto));
			//命中校验规则
			if(StringUtils.isNotEmpty(dto.getIsChkRcCstPrj())){
				if(dto.getIsChkRcCstPrj() == 1){
					Map<String, Object> rcCstBscInfoMap = dto.getRcCstBscInfoMap();
					if(CollectionUtils.isMapNotEmpty(rcCstBscInfoMap)){
						List<RcCstBscInfoDTO> listDto = (List<RcCstBscInfoDTO>) rcCstBscInfoMap.get("rcCstBscInfoList");
						if(CollectionUtils.isNotEmpty(listDto)){
							for (RcCstBscInfoDTO rcCstBscInfoDTO : listDto) {
								if(!rcCstBscInfoDTO.getRskLvlCd().equals("3")){
									splIds.add(rcCstBscInfoDTO.getSplId());
									if(map.get(rcCstBscInfoDTO.getSplId()) != null){
										if((rcCstBscInfoDTO.getId().compareTo(map.get(rcCstBscInfoDTO.getSplId()).getId()) > 0)){
											map.put(rcCstBscInfoDTO.getSplId(), rcCstBscInfoDTO);
										}
									}else{
										map.put(rcCstBscInfoDTO.getSplId(), rcCstBscInfoDTO);
									}
								}
							}
							if(CollectionUtils.isEmpty(splIds)){
								throw new BaseException(BaseExceptionConstant.BASE_EXCEPTION_CODE_601, "未查询到供应商或征信级别低");
							}
						}
					}
				}else{
					Map<String, Object> rcCstBscInfoMap = dto.getRcCstBscInfoMap();
					if(CollectionUtils.isMapNotEmpty(rcCstBscInfoMap)){
						List<RcCstBscInfoDTO> listDto = (List<RcCstBscInfoDTO>) rcCstBscInfoMap.get("rcCstBscInfoList");
						if(CollectionUtils.isNotEmpty(listDto)){
							for (RcCstBscInfoDTO rcCstBscInfoDTO : listDto) {
								map.put(rcCstBscInfoDTO.getSplId(), rcCstBscInfoDTO);
							}
						}
					}
				}
			}
		}
		if(StringUtils.isNotBlank(value) && CollectionUtils.isEmpty(splIds)){
			qc.setSplNm(value);
		}
		qc.setIds(splIds);
		
		page.setCondition(qc);

		BaseLogUtils.info(logger, "initSplList", "初始化供应商列表页面数据.DATA:"+JSONObject.toJSONString(page), CurrentThreadContext.getCurrentUserName());
		Pager pager = this.prjPrdBscInfoService.searchSplListPage(page);
		BaseLogUtils.info(logger,"splInitList","项目产品.经销商列表MAP=" + JSON.toJSONString(map));
		BaseLogUtils.info(logger,"splInitList","项目产品.经销商列表结果=" + JSON.toJSONString(pager));
		List<SplInfoVO> list = (List<SplInfoVO>) pager.getResultList();
		List<SplInfoVO> voList = new ArrayList<>();
		if(CollectionUtils.isMapNotEmpty(map)){
			List<SysDictionaryDTO> startLvlList = this.sysDictionaryApiService.searchGroup(WebBaseConstant.SPL_SYS_CD, CurrentThreadContext.getCurrentOrgCd(), PrjPrdDtlConstant.CODE_GRP_CD_START_LVL);
			for (SplInfoVO vo : list) {
				if(map.containsKey(vo.getId())){
					RcCstBscInfoDTO rcCstBscInfoDTO = map.get(vo.getId());
					Long splStarLevel = rcCstBscInfoDTO.getSplStarLevel();
					if(splStarLevel != null){
						for (SysDictionaryDTO sysDictionaryDTO : startLvlList) {
							String code = sysDictionaryDTO.getCode();
							if (splStarLevel.equals(Long.valueOf(code))) {
								vo.setSplStarLevel(sysDictionaryDTO.getCodeNm());
							}
						}
					}
					vo.setRcCstBscInfoId(rcCstBscInfoDTO.getId());
				}
			}
			if(CollectionUtils.isNotEmpty(splIds)){
				for (SplInfoVO vo : list) {
					if(vo.getSplNm().indexOf(value) >= 0){
						voList.add(vo);
					}
				}
			}
		}
		BaseLogUtils.info(logger,"splInitList","项目产品.经销商列表结果volist=" + JSON.toJSONString(voList));
		BaseLogUtils.info(logger,"splInitList","项目产品.经销商列表结果list=" + JSON.toJSONString(list));
		ListPageVO<SplInfoVO> listPage;
		List<SplInfoVO> listNew = new ArrayList<>();
		if(CollectionUtils.isEmpty(voList)){
			if(BaseConstant.IS_YESNO_YES_STR.equals(isBigCstWork)) {
				for (SplInfoVO splInfoVO : list) {
					Map<String,String> specialBusiness = this.iSplPropInfoApiService.getSpePowMapBySplId(splInfoVO.getId(),CurrentThreadContext.getCurrentSysCd(),CurrentThreadContext.getCurrentOrgCd());
					if(MapUtils.isNotEmpty(specialBusiness)){
						if(specialBusiness.containsKey(PrjQuatPrpsConstant.SPECIAL_BUSINESS_TYPE_7)){
							listNew.add(splInfoVO);
						}
					}
				}
			}else{
				listNew = list;
			}
		}else{
			if(BaseConstant.IS_YESNO_YES_STR.equals(isBigCstWork)) {
				for (SplInfoVO splInfoVO : voList) {
					Map<String,String> specialBusiness = this.iSplPropInfoApiService.getSpePowMapBySplId(splInfoVO.getId(),CurrentThreadContext.getCurrentSysCd(),CurrentThreadContext.getCurrentOrgCd());
					if(MapUtils.isNotEmpty(specialBusiness)){
						if(specialBusiness.containsKey(PrjQuatPrpsConstant.SPECIAL_BUSINESS_TYPE_7)){
							listNew.add(splInfoVO);
						}
					}
				}
			}else{
				listNew = voList;
			}
		}
		listPage = new ListPageVO<SplInfoVO>(listNew, pager.getTotalCount());
		return listPage;
	}

	/**
	* @Description: 推荐经销商初始化列表
	* @author shenhao
	* @date 2020/8/18 14:45
	*/
	@SuppressWarnings("unchecked")
	@RequestMapping(value = "/recommendSplInitList.do", method = { RequestMethod.GET})
	@ResponseBody
	public Object recommendSplInitList(HttpServletRequest request, HttpServletResponse response) {
		String currentPage = request.getParameter("page");
		String pageSize = request.getParameter("pagesize");
		String audStsCdStr = request.getParameter("audStsCdList");
		String isSelectVerify = request.getParameter("isSelectVerify");
		String splNm = request.getParameter("recommendSplNm");
		String condition = request.getParameter("condition");
		Pager page = new Pager();
		if (StringUtils.isNotEmpty(currentPage)) {
			page.setCurrentPage(Integer.parseInt(currentPage));
		}

		if (StringUtils.isNotEmpty(currentPage)) {
			page.setEveryPage(Integer.parseInt(pageSize));
		}

		String value = "";
		if(StringUtils.isNotBlank(condition)){
			String con = condition.substring(1, condition.length()-1);
			if(StringUtils.isNotBlank(con)){
				net.sf.json.JSONObject fromObject = net.sf.json.JSONObject.fromObject(con);
				value = (String) fromObject.get("value");
			}
		}
		SplInfoQueryCondition qc = new SplInfoQueryCondition();
		qc.setIsSelectVerify(1);
		qc.setIsBlackList(9);
		qc.setAudStsCd("2");

		if(StringUtils.isNotBlank(value)){
			qc.setSplNm(value);
		}
		if(StringUtils.isNotBlank(splNm)){
			qc.setSplNm(splNm);
		}
		page.setCondition(qc);

		BaseLogUtils.info(logger, "initSplList", "初始化推荐供应商列表页面数据.DATA:"+JSONObject.toJSONString(page), CurrentThreadContext.getCurrentUserName());
		Pager pager = this.prjPrdBscInfoService.searchSplListPage(page);
		BaseLogUtils.info(logger,"splInitList","项目产品.推荐经销商列表结果=" + JSON.toJSONString(pager));
		List<SplInfoVO> list = (List<SplInfoVO>) pager.getResultList();
		List<SplInfoVO> voList = new ArrayList<>();
		BaseLogUtils.info(logger,"splInitList","项目产品.推荐经销商列表结果volist=" + JSON.toJSONString(voList));
		BaseLogUtils.info(logger,"splInitList","项目产品.推荐经销商列表结果list=" + JSON.toJSONString(list));
		ListPageVO<SplInfoVO> listPage;
		if(CollectionUtils.isEmpty(voList)){
			listPage = new ListPageVO<SplInfoVO>(list, pager.getTotalCount());
		}else{
			listPage = new ListPageVO<SplInfoVO>(voList, pager.getTotalCount());
		}
		return listPage;
	}
	/**
	 * 根据产品分类和明细ID查询商品明细
	 * 
	 * @param request
	 * @return
	 * @throws Exception
	 */
	@RequestMapping(value = "/getDataByDetailId.do", method = { RequestMethod.GET})
	@ResponseBody
	public Object getDataByDetailId(HttpServletRequest request, HttpServletResponse response) throws BaseException {
		String id = request.getParameter("id");
		DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES, "获取成功");
		try {
			//查询商品信息
			PrjPrdBscInfoVO prdBscInfoVO = this.prjPrdBscInfoService.selectPrjPrdBscAndDetailInfoById(id);
			PrdBscInfoVO prdBscInfo = this.prdBscInfoService.selectById(prdBscInfoVO.getPrdId());
			prdBscInfoVO.setPrdMdlSun(prdBscInfo.getPrdMdl());
			if(null == prdBscInfoVO){
				result.setSuccess(BaseConstant.IS_YESNO_NO);
				result.setInfo("数据不存在！");
			}
			result.setData(prdBscInfoVO);
		}catch(BaseException ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(ex.getMessage());
			logger.error(ex.getMessage(), ex);
		}catch(Exception ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo("获取数据失败！");
			logger.error("获取数据失败！", ex);
		}
		return result;
	}
	
	/**
	 * 根据产品分类和明细ID查询商品明细
	 * 
	 * @param request
	 * @return
	 * @throws Exception
	 */
	@RequestMapping(value = "/checkRsrvPc.do", method = { RequestMethod.GET})
	@ResponseBody
	public Object checkRsrvPc(HttpServletRequest request, HttpServletResponse response) throws BaseException {
		DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES, "获取成功");
		try {
			//查询配置留购价信息
			SysCtrlCfgQueryCondition qc = new SysCtrlCfgQueryCondition();
			qc.setOrgCd(CurrentThreadContext.getCurrentOrgCd());
			qc.setSysCd(CurrentThreadContext.getCurrentSysCd());
			qc.setCtrlCode(PrjPrdBscInfoConstant.PRJ_PRD_RSRVPC_CODE);
			String price = this.sysCtrlCfgService.searchSysCtrlCfgByCtrlCode(qc);
			result.setData(price);
		}catch(BaseException ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(ex.getMessage());
			logger.error(ex.getMessage(), ex);
		}catch(Exception ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo("获取数据失败！");
			logger.error("获取数据失败！", ex);
		}
		return result;
	}

	/**
	 * 初始化列表
	 */
	@SuppressWarnings("unchecked")
	@RequestMapping(value = "/initList.do", method = { RequestMethod.GET})
	@ResponseBody
	public Object initList(HttpServletRequest request, HttpServletResponse response) {
		String currentPage = request.getParameter("page");
		String pageSize = request.getParameter("pagesize");
		String prdNm = request.getParameter("prdNm");
		String prdMdl = request.getParameter("prdMdl");
		String prjId = request.getParameter("prjId");
		Pager page = new Pager();
		if (StringUtils.isNotEmpty(currentPage)) {
			page.setCurrentPage(Integer.parseInt(currentPage));
		}

		if (StringUtils.isNotEmpty(currentPage)) {
			page.setEveryPage(Integer.parseInt(pageSize));
		}

		PrjPrdBscInfoQueryCondition qc = new PrjPrdBscInfoQueryCondition();
		if (StringUtils.isNotEmpty(prdNm)) {
			qc.setPrdNm(prdNm);
		}
		if(StringUtils.isNotBlank(prdMdl)){
			qc.setPrdMdl(prdMdl);
		}
		if(StringUtils.isNotBlank(prjId)){
			qc.setPrjId(Long.valueOf(prjId));
		}
		page.setCondition(qc);

		Pager pager = this.prjPrdBscInfoService.searchListPage(page);

        List<PrjPrdBscInfoVO> prjPrdBscInfoVOS =  (List<PrjPrdBscInfoVO>)pager.getResultList();
        BaseLogUtils.info(logger, "initList", "初始化车辆列表.添加路由半成品数据前.prjPrdBscInfoVOS:" + JSON.toJSONString(prjPrdBscInfoVOS), CurrentThreadContext.getCurrentUserName());
        /**
         * 处理资管路由过来的半成品数据
         */
        InsRoutePrdInfoQC insRoutePrdInfoQC = new InsRoutePrdInfoQC();
        insRoutePrdInfoQC.setPrjId(Long.valueOf(prjId));
        List<InsRoutePrdInfoVO> insRoutePrdInfoVOS = this.insRoutePrdInfoService.searchList(insRoutePrdInfoQC);
        BaseLogUtils.info(logger, "initList", "初始化车辆列表.路由半成品数据.insRoutePrdInfoVOS:" + JSON.toJSONString(insRoutePrdInfoVOS), CurrentThreadContext.getCurrentUserName());
        int routeCount = 0;
        if(CollectionUtils.isNotEmpty(insRoutePrdInfoVOS)){
			PrjBscInfoVO prjBscInfoVO = this.prjBscInfoService.selectById(Long.valueOf(prjId));
			String prjTypCd = prjBscInfoVO.getPrjTypCd();
			for(InsRoutePrdInfoVO insRoutePrdInfoVO : insRoutePrdInfoVOS){
                Long prjPrdId = insRoutePrdInfoVO.getPrjPrdId();
                if(prjPrdId  == null){
					PrjPrdBscInfoVO prjPrdBscInfoVO = new PrjPrdBscInfoVO();
					prjPrdBscInfoVO.setInsRoutePrdId(insRoutePrdInfoVO.getId());
					prjPrdBscInfoVO.setPrdTypCd(insRoutePrdInfoVO.getPrdTypCd());
					prjPrdBscInfoVO.setBrCd(insRoutePrdInfoVO.getBrCd());//品牌名称
					prjPrdBscInfoVO.setBrId(insRoutePrdInfoVO.getBrId());//品牌ID
					prjPrdBscInfoVO.setModelId(insRoutePrdInfoVO.getModelId());//车系ID
					prjPrdBscInfoVO.setModelNm(insRoutePrdInfoVO.getModelNm());//车系名称
					prjPrdBscInfoVO.setPrdRouteId(insRoutePrdInfoVO.getPrdId());//用途ID
					prjPrdBscInfoVO.setPrdNm(insRoutePrdInfoVO.getPrdNm());//用途名称
					prjPrdBscInfoVO.setPrdQty(insRoutePrdInfoVO.getPrdQty());//数量
					prjPrdBscInfoVO.setGuidePc(DecimalUtils.convertFenToYuan(insRoutePrdInfoVO.getGuidePc().longValue()));//指导价
                    if(PrjBscInfoConstant.PRJ_TYP_CD_CDDYWUL.equals(prjTypCd) || PrjBscInfoConstant.PRJ_TYP_CD_ESCJYD.equals(prjTypCd) || PrjBscInfoConstant.PRJ_TYP_CD_OWNJYD.equals(prjTypCd)){
                        prjPrdBscInfoVO.setVehId(insRoutePrdInfoVO.getVehId());
                    }
					if(insRoutePrdInfoVO.getGuidePc() != null && insRoutePrdInfoVO.getPrdQty() != null){
						Double prdAmt = DecimalUtils.mul(insRoutePrdInfoVO.getGuidePc(), insRoutePrdInfoVO.getPrdQty());
						prjPrdBscInfoVO.setPrdAmt(DecimalUtils.convertFenToYuan(prdAmt.longValue()));//合计
					}
					if(CollectionUtils.isNotEmpty(prjPrdBscInfoVOS)){
						prjPrdBscInfoVOS.add(prjPrdBscInfoVO);
					}else {
						prjPrdBscInfoVOS = new ArrayList<PrjPrdBscInfoVO>();
						prjPrdBscInfoVOS.add(prjPrdBscInfoVO);
					}
					routeCount++;
                }
            }
        }
        BaseLogUtils.info(logger, "initList", "初始化车辆列表.添加路由半成品数据后.prjPrdBscInfoVOS:" + JSON.toJSONString(prjPrdBscInfoVOS), CurrentThreadContext.getCurrentUserName());
        ListPageVO<PrjPrdBscInfoVO> listPage = new ListPageVO<PrjPrdBscInfoVO>(prjPrdBscInfoVOS, pager.getTotalCount()+ routeCount);
		BaseLogUtils.info(logger, "initList", "查询数据完成. DATA:" + JSONObject.toJSONString(page), CurrentThreadContext.getCurrentUserName());
		return listPage;
	}
	/**
	 * 删除项目产品信息和支付表信息
	 */
	@RequestMapping(value = "/removePrjPrdAndPrjPrdPayList.do", method = {RequestMethod.POST })
	@ResponseBody
	public DataResultVO removePrjPrdAndPrjPrdPayList(HttpServletRequest request, HttpServletResponse response) throws BaseException {
		BaseLogUtils.info(logger,"removePrjPrdAndPrjPrdPayList","删除项目产品信息和支付表信息.请求参数：" + this.getRequestParameter(request));
		String ids = request.getParameter("ids");
		String prjId = request.getParameter("prjId");//项目ID
		String routeIds = request.getParameter("routeIds");//路由ID
		DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES, SysLogConstant.LOG_CMM_DELETE_SUCC);
		if(StringUtils.isEmpty(ids)&&StringUtils.isBlank(prjId) && StringUtils.isEmpty(routeIds)){
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_DATA_PK_IS_EMPTY);
			return result;
		}
		PrjBscInfoVO prjBscInfoVO = this.prjBscInfoService.selectById(Long.valueOf(prjId));
		String prjTypCd = prjBscInfoVO.getPrjTypCd();
		List<Long> idList = new ArrayList<Long>();
		JSONArray idsArray = JSONArray.fromObject(ids);
		if(!idsArray.isEmpty()){
			for (Object object : idsArray) {
				idList.add(Long.valueOf(object.toString()));
			}
		}
		List<Long> routeIdList = new ArrayList<Long>();
		JSONArray routeIdsArray = JSONArray.fromObject(routeIds);
		if(!routeIdsArray.isEmpty()){
			for (Object object : routeIdsArray) {
				routeIdList.add(Long.valueOf(object.toString()));
			}
		}
		try {
			if(idList.size()>0){
				PrjPrdBscInfoQueryCondition qc = new PrjPrdBscInfoQueryCondition();
				qc.setIdList(idList);
				List<PrjPrdBscInfoVO> prjPrdBscInfoVOS = this.prjPrdBscInfoService.searchList(qc);
				this.prjPrdBscInfoService.removePrjPrdAndPrjPrdPayList(idList,Long.valueOf(prjId));
				if(CollectionUtils.isNotEmpty(prjPrdBscInfoVOS)){
					for (PrjPrdBscInfoVO prjPrdBscInfoVO : prjPrdBscInfoVOS) {
						if(null!=prjPrdBscInfoVO.getGuidePc()){
							prjPrdBscInfoVO.setGuidePc(DecimalUtils.convertYuanToFen(prjPrdBscInfoVO.getGuidePc()).doubleValue());
						}
					}
					boolean insFlag = true;
					if(PrjBscInfoConstant.PRJ_TYP_CD_CDDYWUL.equals(prjTypCd) || PrjBscInfoConstant.PRJ_TYP_CD_ESCJYD.equals(prjTypCd) || PrjBscInfoConstant.PRJ_TYP_CD_OWNJYD.equals(prjTypCd)){
						insFlag = this.insRouteBscInfoService.synchroInsInfoEsc(prjPrdBscInfoVOS,2);
					}else{
						insFlag = this.insRouteBscInfoService.synchroInsInfo(prjPrdBscInfoVOS,2);
					}
					BaseLogUtils.info(logger,"removeById","同步路由信息.insFlag:" + insFlag,CurrentThreadContext.getCurrentUserName());
				}
			}
			if(routeIdList.size()>0){
				for (Long routeId : routeIdList) {
					InsRoutePrdInfoVO insRoutePrdInfoVO = this.insRoutePrdInfoService.selectById(Long.valueOf(routeId));
					InsRouteBscInfoVO insRouteBscInfoVO = this.insRouteBscInfoService.searchListByPrjId(Long.valueOf(prjId));
					if(insRouteBscInfoVO != null){
						Double contAmt = insRouteBscInfoVO.getContAmt();//合同额
						Double feeAmt01 = 0d;//首期
						Double feePct01 = 0d;//首期比例
						Double feeAmt02 = 0d;//客户保证金
						Double feePct02 = 0d;//客户保证金比例
						Double feeAmt63 = 0d;//发票金额
						Double feeAmt64 = 0d;//补票
						List<InsRoutePrpsFeeVO> insRoutePrpsFeeVOList = insRouteBscInfoVO.getInsRoutePrpsFeeVOList();
						BaseLogUtils.info(logger,"removeById","同步路由信息.路由费用项信息：insRoutePrpsFeeVOList" + JSON.toJSONString(insRoutePrpsFeeVOList),CurrentThreadContext.getCurrentUserName());
						if(CollectionUtils.isNotEmpty(insRoutePrpsFeeVOList)){
							for (InsRoutePrpsFeeVO insRoutePrpsFeeVO : insRoutePrpsFeeVOList) {
								String feeTypCd = insRoutePrpsFeeVO.getFeeTypCd();
								if(PrjQuatPrpsFeeConstant.FEE_TYP_CD_01.equals(feeTypCd)){
									feeAmt01 = insRoutePrpsFeeVO.getFeeAmt();
									feePct01 = insRoutePrpsFeeVO.getFeePct();
								}
								if(PrjQuatPrpsFeeConstant.FEE_TYP_CD_02.equals(feeTypCd)){
									feeAmt02 = insRoutePrpsFeeVO.getFeeAmt();
									feePct02 = insRoutePrpsFeeVO.getFeePct();
								}
								if(PrjQuatPrpsFeeConstant.FEE_TYP_CD_63.equals(feeTypCd)){
									feeAmt63 = insRoutePrpsFeeVO.getFeeAmt();
								}
								if(PrjQuatPrpsFeeConstant.FEE_TYP_CD_64.equals(feeTypCd)){
									feeAmt64 = insRoutePrpsFeeVO.getFeeAmt();
								}
							}
						}
						BaseLogUtils.info(logger,"removeById","同步路由信息.数据变化前：contAmt=" + contAmt + "-feeAmt01=" + feeAmt01 + "-feeAmt02=" + feeAmt02 + "-feeAmt64=" + feeAmt64,CurrentThreadContext.getCurrentUserName());
						Long mediationFeeAmt = insRoutePrdInfoVO.getMediationFeeAmt() == null ? 0l : insRoutePrdInfoVO.getMediationFeeAmt();
						if(PrjBscInfoConstant.PRJ_TYP_CD_CDDYWUL.equals(prjTypCd) || PrjBscInfoConstant.PRJ_TYP_CD_ESCJYD.equals(prjTypCd) || PrjBscInfoConstant.PRJ_TYP_CD_OWNJYD.equals(prjTypCd)){
							contAmt -= DecimalUtils.mul(insRoutePrdInfoVO.getGuidePc() + mediationFeeAmt,insRoutePrdInfoVO.getPrdQty());
						}else{
							contAmt -= DecimalUtils.mul(insRoutePrdInfoVO.getGuidePc(),insRoutePrdInfoVO.getPrdQty());
						}
						feeAmt01 = DecimalUtils.mul(feePct01/100,contAmt);
						feeAmt02 = DecimalUtils.mul(feePct02/100,(contAmt-feeAmt01));
						feeAmt64 = contAmt - feeAmt63;
						insRouteBscInfoVO.setContAmt(contAmt);
						if(CollectionUtils.isNotEmpty(insRoutePrpsFeeVOList)){
							for (InsRoutePrpsFeeVO insRoutePrpsFeeVO : insRoutePrpsFeeVOList) {
								String feeTypCd = insRoutePrpsFeeVO.getFeeTypCd();
								if(PrjQuatPrpsFeeConstant.FEE_TYP_CD_01.equals(feeTypCd)){
									insRoutePrpsFeeVO.setFeeAmt(feeAmt01);
									this.insRoutePrpsFeeService.modify(insRoutePrpsFeeVO);
								}
								if(PrjQuatPrpsFeeConstant.FEE_TYP_CD_02.equals(feeTypCd)){
									insRoutePrpsFeeVO.setFeeAmt(feeAmt02);
									this.insRoutePrpsFeeService.modify(insRoutePrpsFeeVO);
								}
								if(PrjQuatPrpsFeeConstant.FEE_TYP_CD_64.equals(feeTypCd)){
									if(feeAmt64<0){
										feeAmt64 = 0d;
									}
									insRoutePrpsFeeVO.setFeeAmt(feeAmt64);
									this.insRoutePrpsFeeService.modify(insRoutePrpsFeeVO);
								}
							}
						}
						this.insRouteBscInfoService.modify(insRouteBscInfoVO);
					}else{
						throw new BaseException("路由信息异常");
					}
					boolean flag = this.insRoutePrdInfoService.removeById(Long.valueOf(routeId));
					BaseLogUtils.info(logger, "removeById", "删除路由设备信息.结果flag：" + flag + "-routeId：" + routeId, CurrentThreadContext.getCurrentUserName());
				}
			}
			BaseLogUtils.info(logger, "removeById", "删除项目产品信息和支付表信息.ids=" + ids + "-routeIds=" + routeIds, CurrentThreadContext.getCurrentUserName());
		}catch (BaseException ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(ex.getMessage());
			BaseLogUtils.info(logger, "removeById", "删除数据失败.[id="+ids+"]"+ex.getMessage(), CurrentThreadContext.getCurrentUserName());
		}catch (Exception ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_SYS_ERROR);
			BaseLogUtils.error(logger, "removeById", "删除数据失败.[id="+ids+"]"+ex.getMessage(), CurrentThreadContext.getCurrentUserName());
		}
		result.setSuccess(BaseConstant.IS_YESNO_YES);
		return result;
	}
	
	/**
	 * 删除数据
	 */
	@RequestMapping(value = "/removeByIds.do", method = {RequestMethod.POST })
	@ResponseBody
	public DataResultVO removeByIds(HttpServletRequest request, HttpServletResponse response) throws BaseException {
		BaseLogUtils.info(logger,"removeByIds","删除项目产品数据.请求参数：" + this.getRequestParameter(request));
		String ids = request.getParameter("ids");
		String routeIds = request.getParameter("routeIds");//路由ID
		DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES, SysLogConstant.LOG_CMM_DELETE_SUCC);
		if((StringUtils.isEmpty(ids) || ids.equals("[]")) && (StringUtils.isEmpty(routeIds) || routeIds.equals("[]"))){
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_DATA_PK_IS_EMPTY);
			return result;
		}
		List<Long> idList = new ArrayList<Long>();
		if(StringUtils.isNotBlank(ids)){
			JSONArray idsArray = JSONArray.fromObject(ids);
			if(!idsArray.isEmpty()){
				for (Object object : idsArray) {
					idList.add(Long.valueOf(object.toString()));
				}
			}
		}
		List<Long> routeIdList = new ArrayList<Long>();
		if(StringUtils.isNotBlank(routeIds)){
			JSONArray routeIdsArray = JSONArray.fromObject(routeIds);
			if(!routeIdsArray.isEmpty()){
				for (Object object : routeIdsArray) {
					routeIdList.add(Long.valueOf(object.toString()));
				}
			}
		}
		BaseLogUtils.info(logger,"removeByIds","删除项目产品数据.解析参数idList：" + JSON.toJSONString(idList) + "-routeIdList:" + JSON.toJSONString(routeIdList));
		try {
			if(CollectionUtils.isNotEmpty(idList)){
				PrjPrdBscInfoQueryCondition qc = new PrjPrdBscInfoQueryCondition();
				qc.setIdList(idList);
				List<PrjPrdBscInfoVO> prjPrdBscInfoVOS = this.prjPrdBscInfoService.searchList(qc);
				this.prjPrdBscInfoService.removeByIds(idList);
				if(CollectionUtils.isNotEmpty(prjPrdBscInfoVOS)){
					Long prjId = prjPrdBscInfoVOS.get(0).getPrjId();
					PrjBscInfoVO prjBscInfoVO = this.prjBscInfoService.selectById(prjId);
					String prjTypCd = prjBscInfoVO.getPrjTypCd();
					for (PrjPrdBscInfoVO prjPrdBscInfoVO : prjPrdBscInfoVOS) {
						if(null!=prjPrdBscInfoVO.getGuidePc()){
							prjPrdBscInfoVO.setGuidePc(DecimalUtils.convertYuanToFen(prjPrdBscInfoVO.getGuidePc()).doubleValue());
						}
					}
					boolean insFlag = true;
					if(PrjBscInfoConstant.PRJ_TYP_CD_CDDYWUL.equals(prjTypCd) || PrjBscInfoConstant.PRJ_TYP_CD_ESCJYD.equals(prjTypCd) || PrjBscInfoConstant.PRJ_TYP_CD_OWNJYD.equals(prjTypCd)){
						insFlag = this.insRouteBscInfoService.synchroInsInfoEsc(prjPrdBscInfoVOS,2);
					}else{
						insFlag = this.insRouteBscInfoService.synchroInsInfo(prjPrdBscInfoVOS,2);
					}
					BaseLogUtils.info(logger,"removeById","同步路由信息.insFlag:" + insFlag,CurrentThreadContext.getCurrentUserName());
				}
			}
			if(CollectionUtils.isNotEmpty(routeIdList)){
				for (Long routeId : routeIdList) {
					InsRoutePrdInfoVO insRoutePrdInfoVO = this.insRoutePrdInfoService.selectById(Long.valueOf(routeId));
					Long prjId = insRoutePrdInfoVO.getPrjId();
					PrjBscInfoVO prjBscInfoVO = this.prjBscInfoService.selectById(prjId);
					String prjTypCd = prjBscInfoVO.getPrjTypCd();
					InsRouteBscInfoVO insRouteBscInfoVO = this.insRouteBscInfoService.searchListByPrjId(prjId);
					if(insRouteBscInfoVO != null){
						Double contAmt = insRouteBscInfoVO.getContAmt();//合同额
						Double feeAmt01 = 0d;//首期
						Double feePct01 = 0d;//首期比例
						Double feeAmt02 = 0d;//客户保证金
						Double feePct02 = 0d;//客户保证金比例
						Double feeAmt63 = 0d;//主票
						Double feeAmt64 = 0d;//补票
						List<InsRoutePrpsFeeVO> insRoutePrpsFeeVOList = insRouteBscInfoVO.getInsRoutePrpsFeeVOList();
						BaseLogUtils.info(logger,"removeById","同步路由信息.路由费用项信息：insRoutePrpsFeeVOList" + JSON.toJSONString(insRoutePrpsFeeVOList),CurrentThreadContext.getCurrentUserName());
						if(CollectionUtils.isNotEmpty(insRoutePrpsFeeVOList)){
							for (InsRoutePrpsFeeVO insRoutePrpsFeeVO : insRoutePrpsFeeVOList) {
								String feeTypCd = insRoutePrpsFeeVO.getFeeTypCd();
								if(PrjQuatPrpsFeeConstant.FEE_TYP_CD_01.equals(feeTypCd)){
									feeAmt01 = insRoutePrpsFeeVO.getFeeAmt();
									feePct01 = insRoutePrpsFeeVO.getFeePct();
								}
								if(PrjQuatPrpsFeeConstant.FEE_TYP_CD_02.equals(feeTypCd)){
									feeAmt02 = insRoutePrpsFeeVO.getFeeAmt();
									feePct02 = insRoutePrpsFeeVO.getFeePct();
								}
								if(PrjQuatPrpsFeeConstant.FEE_TYP_CD_63.equals(feeTypCd)){
									feeAmt63 = insRoutePrpsFeeVO.getFeeAmt();
								}
								if(PrjQuatPrpsFeeConstant.FEE_TYP_CD_64.equals(feeTypCd)){
									feeAmt64 = insRoutePrpsFeeVO.getFeeAmt();
								}
							}
						}
						BaseLogUtils.info(logger,"removeById","同步路由信息.数据变化前：contAmt=" + contAmt + "-feeAmt01=" + feeAmt01 + "-feeAmt02=" + feeAmt02 + "-feeAmt64=" + feeAmt64,CurrentThreadContext.getCurrentUserName());
						Long mediationFeeAmt = insRoutePrdInfoVO.getMediationFeeAmt() == null ? 0l : insRoutePrdInfoVO.getMediationFeeAmt();
						if(PrjBscInfoConstant.PRJ_TYP_CD_CDDYWUL.equals(prjTypCd) || PrjBscInfoConstant.PRJ_TYP_CD_ESCJYD.equals(prjTypCd) || PrjBscInfoConstant.PRJ_TYP_CD_OWNJYD.equals(prjTypCd)){
							contAmt -= DecimalUtils.mul(insRoutePrdInfoVO.getGuidePc() + mediationFeeAmt,insRoutePrdInfoVO.getPrdQty());
						}else{
							contAmt -= DecimalUtils.mul(insRoutePrdInfoVO.getGuidePc(),insRoutePrdInfoVO.getPrdQty());
						}
						feeAmt01 = DecimalUtils.mul(feePct01/100,contAmt);
						feeAmt02 = DecimalUtils.mul(feePct02/100,(contAmt-feeAmt01));
						feeAmt64 = contAmt - feeAmt63;
						insRouteBscInfoVO.setContAmt(contAmt);
						if(CollectionUtils.isNotEmpty(insRoutePrpsFeeVOList)){
							for (InsRoutePrpsFeeVO insRoutePrpsFeeVO : insRoutePrpsFeeVOList) {
								String feeTypCd = insRoutePrpsFeeVO.getFeeTypCd();
								if(PrjQuatPrpsFeeConstant.FEE_TYP_CD_01.equals(feeTypCd)){
									insRoutePrpsFeeVO.setFeeAmt(feeAmt01);
									this.insRoutePrpsFeeService.modify(insRoutePrpsFeeVO);
								}
								if(PrjQuatPrpsFeeConstant.FEE_TYP_CD_02.equals(feeTypCd)){
									insRoutePrpsFeeVO.setFeeAmt(feeAmt02);
									this.insRoutePrpsFeeService.modify(insRoutePrpsFeeVO);
								}
								if(PrjQuatPrpsFeeConstant.FEE_TYP_CD_64.equals(feeTypCd)){
									if(feeAmt64<0){
										feeAmt64 = 0d;
									}
									insRoutePrpsFeeVO.setFeeAmt(feeAmt64);
									this.insRoutePrpsFeeService.modify(insRoutePrpsFeeVO);
								}
							}
						}
						this.insRouteBscInfoService.modify(insRouteBscInfoVO);
					}else{
						if(!(PrjBscInfoConstant.PRJ_TYP_CD_CDDYWUL.equals(prjTypCd) || PrjBscInfoConstant.PRJ_TYP_CD_ESCJYD.equals(prjTypCd) || PrjBscInfoConstant.PRJ_TYP_CD_OWNJYD.equals(prjTypCd))){
							throw new BaseException("路由信息异常");
						}
					}
					boolean flag = this.insRoutePrdInfoService.removeById(Long.valueOf(routeId));
					BaseLogUtils.info(logger, "removeById", "删除路由设备信息.结果flag：" + flag + "-routeId：" + routeId, CurrentThreadContext.getCurrentUserName());
				}
			}
			BaseLogUtils.info(logger, "removeById", "删除项目产品数据.ids=" + ids + "-routeIds=" + routeIds, CurrentThreadContext.getCurrentUserName());
		}catch (BaseException ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(ex.getMessage());
			BaseLogUtils.info(logger, "removeById", "删除数据失败.[id="+ids+"]"+ex.getMessage(), CurrentThreadContext.getCurrentUserName());
		}catch (Exception ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_SYS_ERROR);
			BaseLogUtils.error(logger, "removeById", "删除数据失败.[id="+ids+"]"+ex.getMessage(), CurrentThreadContext.getCurrentUserName());
		}
		result.setSuccess(BaseConstant.IS_YESNO_YES);
		return result;
	}

	/**
	 * 删除数据
	 */
	@RequestMapping(value = "/removeById.do", method = {RequestMethod.POST })
	@ResponseBody
	public DataResultVO removeById(HttpServletRequest request, HttpServletResponse response) throws BaseException {
		String id = request.getParameter("id");
		DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES, SysLogConstant.LOG_CMM_DELETE_SUCC);
		if(StringUtils.isEmpty(id)){
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_DATA_PK_IS_EMPTY);
			return result;
		}
		try {
			this.prjPrdBscInfoService.removeById(Long.valueOf(id));
			BaseLogUtils.info(logger, "removeById", "删除数据.[id="+id+"]", CurrentThreadContext.getCurrentUserName());
		}catch (BaseException ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(ex.getMessage());
			BaseLogUtils.info(logger, "removeById", "删除数据失败.[id="+id+"]"+ex.getMessage(), CurrentThreadContext.getCurrentUserName());
		}catch (Exception ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_SYS_ERROR);
			BaseLogUtils.error(logger, "removeById", "删除数据失败.[id="+id+"]"+ex.getMessage(), CurrentThreadContext.getCurrentUserName());
		}

		return result;
	}

	/**
	 * 得到一条记录
	 * 
	 * @param request
	 * @return
	 * @throws Exception
	 */
	@RequestMapping(value = "/getById.do", method = { RequestMethod.GET})
	@ResponseBody
	public Object getById(HttpServletRequest request, HttpServletResponse response) throws BaseException {
		String id = request.getParameter("id");
		DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES, SysLogConstant.LOG_CMM_OPERATE_SUCC);
		if(StringUtils.isEmpty(id)){
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_DATA_PK_IS_EMPTY);
			BaseLogUtils.error(logger, "getById", "获取数据,主键不存在.[id="+id+"]", CurrentThreadContext.getCurrentUserName());
			return result;
		}
		
		try {
			PrjPrdBscInfoVO vo = this.prjPrdBscInfoService.selectById(Long.valueOf(id));
			if(null == vo){
				result.setSuccess(BaseConstant.IS_YESNO_NO);
				result.setInfo(SysLogConstant.LOG_CMM_QUERY_DATA_IS_EMPTY);
				BaseLogUtils.info(logger, "getById", "获取数据,数据不存在.[id="+id+"]", CurrentThreadContext.getCurrentUserName());
			}
			result.setData(vo);
			BaseLogUtils.info(logger, "getById", "获取数据.[id="+id+"]", CurrentThreadContext.getCurrentUserName());
		}catch(BaseException ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(ex.getMessage());
			BaseLogUtils.info(logger, "getById", "获取失败.[id="+id+"]"+ex.getMessage(), CurrentThreadContext.getCurrentUserName());
		}catch(Exception ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_SYS_ERROR);
			BaseLogUtils.error(logger, "getById", "获取失败.[id="+id+"]"+ex.getMessage(), CurrentThreadContext.getCurrentUserName());
		}
		return result;
	}

	/**
	 * 新增
	 */
	@RequestMapping(value = "/add.do", method = { RequestMethod.POST })
	@ResponseBody
	public Object add(HttpServletRequest request, HttpServletResponse response) throws BaseException {
		String name = request.getParameter("name");
		DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES, SysLogConstant.LOG_CMM_ADD_SUCC);
		PrjPrdBscInfoVO entity = null;
		try {
			entity = new PrjPrdBscInfoVO();
			//TODO ADD PARAM
			Long id = this.prjPrdBscInfoService.add(entity);
			result.setData(id);
			BaseLogUtils.info(logger, "add", "新增数据.[id="+id+"] DATA:" + JSONObject.toJSONString(entity), CurrentThreadContext.getCurrentUserName());
		}catch (BaseException ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(ex.getMessage());
			BaseLogUtils.info(logger, "add", "新增数据失败.DATA:" + JSONObject.toJSONString(entity) + ex.getMessage(), CurrentThreadContext.getCurrentUserName());
		}catch (Exception ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_SYS_ERROR);
			BaseLogUtils.error(logger, "add", "新增数据失败.DATA:" + JSONObject.toJSONString(entity) + ex.getMessage(), CurrentThreadContext.getCurrentUserName());
		}

		return result;
	}

	/**
	 * 修改
	 */
	@RequestMapping(value = "/modify.do", method = { RequestMethod.POST })
	@ResponseBody
	public Object modify(HttpServletRequest request, HttpServletResponse response) throws BaseException {
		String id = request.getParameter("id");
		String name = request.getParameter("name");
		String certDt = request.getParameter("certDt");// 登记证书日期
		String vehCheckCode = request.getParameter("vehCheckCode");//验车方式
		String vehVal = request.getParameter("vehVal");//车辆估值
		DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES, SysLogConstant.LOG_CMM_UPDATE_SUCC);
		if(StringUtils.isEmpty(id)){
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_DATA_PK_IS_EMPTY);
			BaseLogUtils.info(logger, "modify", "修改数据,主键不存在.[id="+id+"]", CurrentThreadContext.getCurrentUserName());
			return result;
		}
		PrjPrdBscInfoVO entity = null;
		try {
			entity = new PrjPrdBscInfoVO();
			entity.setId(Long.valueOf(id));
			if (StringUtils.isNotBlank(certDt)) {
				entity.setCertDt(DateUtils.formatStringToDate(certDt, DateUtils.YYYY_MM_DD));
			}
			if (StringUtils.isNotEmpty(vehCheckCode)) {
				entity.setVehCheckCode(vehCheckCode);
			}
			if(StringUtils.isNotBlank(vehVal)){
				entity.setVehVal(DecimalUtils.convertYuanToFen(Double.valueOf(vehVal)).doubleValue());
			}
			//entity.setName(name);
			//TODO ADD PARAM
			boolean success = this.prjPrdBscInfoService.modify(entity);
			if(!success){
				result.setSuccess(BaseConstant.IS_YESNO_NO);
				result.setInfo(SysLogConstant.LOG_CMM_SYS_ERROR);
				BaseLogUtils.info(logger, "modify", "修改失败.[id="+id+"] DATA:" + JSONObject.toJSONString(entity), CurrentThreadContext.getCurrentUserName());
			}
			BaseLogUtils.info(logger, "modify", "修改成功.[id="+id+"] DATA:" + JSONObject.toJSONString(entity), CurrentThreadContext.getCurrentUserName());
		}catch (BaseException ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(ex.getMessage());
			BaseLogUtils.info(logger, "modify", "修改失败.[id="+id+"] DATA:" + JSONObject.toJSONString(entity) + ex.getMessage(), CurrentThreadContext.getCurrentUserName());
		}catch (Exception ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_SYS_ERROR);
			BaseLogUtils.error(logger, "modify", "修改失败.[id="+id+"] DATA:" + JSONObject.toJSONString(entity) + ex.getMessage(), CurrentThreadContext.getCurrentUserName());
		}
		return result;
	}
	
	/**
	 * 初始化列表
	 */
	@SuppressWarnings("unchecked")
	@RequestMapping(value = "/prjPrdInitList.do", method = { RequestMethod.GET})
	@ResponseBody
	public Object prjPrdInitList(HttpServletRequest request, HttpServletResponse response) {
		String currentPage = request.getParameter("page");
		String pageSize = request.getParameter("pagesize");
		String prjId = request.getParameter("prjId");
		Pager page = new Pager();
		if (StringUtils.isNotEmpty(currentPage)) {
			page.setCurrentPage(Integer.parseInt(currentPage));
		}

		if (StringUtils.isNotEmpty(currentPage)) {
			page.setEveryPage(Integer.parseInt(pageSize));
		}

		PrjPrdBscInfoQueryCondition qc = new PrjPrdBscInfoQueryCondition();
		if(StringUtils.isNotBlank(prjId)){
			qc.setPrjId(Long.valueOf(prjId));
		}
		qc.setSysCd(CurrentThreadContext.getCurrentSysCd());
		qc.setOrgCd(CurrentThreadContext.getCurrentOrgCd());
		page.setCondition(qc);

		Pager pager = this.prjPrdBscInfoService.searchPrjPrdListPage(page);
		List<PrjPrdBscInfoVO> result = (List<PrjPrdBscInfoVO>)pager.getResultList();
		for (PrjPrdBscInfoVO prjPrdBscInfoVO : result) {
			if(prjPrdBscInfoVO.getRecommendSplId() != null){
				SplRlPsnQueryCondition rlQc = new SplRlPsnQueryCondition();
				rlQc.setIsDel(BaseConstant.IS_YESNO_NO);
				rlQc.setSplId(prjPrdBscInfoVO.getRecommendSplId());
				List<SplRlPsnVO> rlPsnList = splRlPsnService.searchList(rlQc);
				JSONObject jsonObject = this.getSlpRlInfo(rlPsnList);
				prjPrdBscInfoVO.setRecommendCtrNm(jsonObject.getString("ctrNm"));
				prjPrdBscInfoVO.setRecommendCtrTel(jsonObject.getString("ctrTel").replaceAll("(\\d{3})\\d{4}(\\d{4})", "$1****$2"));
			}
		}
		ListPageVO<PrjPrdBscInfoVO> listPage = new ListPageVO<PrjPrdBscInfoVO>(result, pager.getTotalCount());
		
		BaseLogUtils.info(logger, "initList", "查询数据完成. DATA:" + JSONObject.toJSONString(page), CurrentThreadContext.getCurrentUserName());
		return listPage;
	}

	private JSONObject getSlpRlInfo(List<SplRlPsnVO> rlPsnList) {
		//顺序展示：实际控制人>法人代表>委托代理人>联系人>股东>总经理>董事>监事>经理
		//4  1  2  3  5  10 11 12 13
		JSONObject jsonObject = new JSONObject();
		jsonObject.put("ctrNm","");
		jsonObject.put("ctrTel","");
		//实际控制人
		String actualControlCtrNm = "";
		String actualControlCtrTel = "";
		//法人代表
		String legalPersonCtrNm = "";
		String legalPersonCtrTel = "";
		//委托代理人
		String agentCtrNm = "";
		String agentCtrTel = "";
		//联系人
		String contactCtrNm = "";
		String contactCtrTel = "";
		//股东
		String shareholdersCtrNm = "";
		String shareholdersCtrTel = "";
		//总经理
		String generalManagerCtrNm = "";
		String generalManagerCtrTel = "";
		//董事
		String directorCtrNm = "";
		String directorCtrTel = "";
		//监事
		String supervisorsCtrNm = "";
		String supervisorsCtrTel = "";
		//经理
		String managerCtrNm = "";
		String managerCtrTel = "";
		for (SplRlPsnVO splRlPsnVO : rlPsnList) {
			if(splRlPsnVO.getRlTypCd().equals("4")){
				actualControlCtrNm = splRlPsnVO.getRlNm();
				actualControlCtrTel = splRlPsnVO.getTel();
			}
			if(splRlPsnVO.getRlTypCd().equals("1")){
				legalPersonCtrNm = splRlPsnVO.getRlNm();
				legalPersonCtrTel = splRlPsnVO.getTel();
			}
			if(splRlPsnVO.getRlTypCd().equals("2")){
				agentCtrNm = splRlPsnVO.getRlNm();
				agentCtrTel = splRlPsnVO.getTel();
			}
			if(splRlPsnVO.getRlTypCd().equals("3")){
				contactCtrNm = splRlPsnVO.getRlNm();
				contactCtrTel = splRlPsnVO.getTel();
			}
			if(splRlPsnVO.getRlTypCd().equals("5")){
				shareholdersCtrNm = splRlPsnVO.getRlNm();
				shareholdersCtrTel = splRlPsnVO.getTel();
			}
			if(splRlPsnVO.getRlTypCd().equals("10")){
				generalManagerCtrNm = splRlPsnVO.getRlNm();
				generalManagerCtrTel = splRlPsnVO.getTel();
			}
			if(splRlPsnVO.getRlTypCd().equals("11")){
				directorCtrNm = splRlPsnVO.getRlNm();
				directorCtrTel = splRlPsnVO.getTel();
			}
			if(splRlPsnVO.getRlTypCd().equals("12")){
				supervisorsCtrNm = splRlPsnVO.getRlNm();
				supervisorsCtrTel = splRlPsnVO.getTel();
			}
			if(splRlPsnVO.getRlTypCd().equals("13")){
				managerCtrNm = splRlPsnVO.getRlNm();
				managerCtrTel = splRlPsnVO.getTel();
			}
		}
		if(StringUtils.isNotBlank(actualControlCtrNm)){
			jsonObject.put("ctrNm",actualControlCtrNm);
			jsonObject.put("ctrTel",actualControlCtrTel);
			return jsonObject;
		}else if(StringUtils.isNotBlank(legalPersonCtrNm)){
			jsonObject.put("ctrNm",legalPersonCtrNm);
			jsonObject.put("ctrTel",legalPersonCtrTel);
			return jsonObject;
		}else if(StringUtils.isNotBlank(agentCtrNm)){
			jsonObject.put("ctrNm",agentCtrNm);
			jsonObject.put("ctrTel",agentCtrTel);
			return jsonObject;
		}else if(StringUtils.isNotBlank(contactCtrNm)){
			jsonObject.put("ctrNm",contactCtrNm);
			jsonObject.put("ctrTel",contactCtrTel);
			return jsonObject;
		}else if(StringUtils.isNotBlank(shareholdersCtrNm)){
			jsonObject.put("ctrNm",shareholdersCtrNm);
			jsonObject.put("ctrTel",shareholdersCtrTel);
			return jsonObject;
		}else if(StringUtils.isNotBlank(generalManagerCtrNm)){
			jsonObject.put("ctrNm",generalManagerCtrNm);
			jsonObject.put("ctrTel",generalManagerCtrTel);
			return jsonObject;
		}else if(StringUtils.isNotBlank(directorCtrNm)){
			jsonObject.put("ctrNm",directorCtrNm);
			jsonObject.put("ctrTel",directorCtrTel);
			return jsonObject;
		}else if(StringUtils.isNotBlank(supervisorsCtrNm)){
			jsonObject.put("ctrNm",supervisorsCtrNm);
			jsonObject.put("ctrTel",supervisorsCtrTel);
			return jsonObject;
		}else if(StringUtils.isNotBlank(managerCtrNm)){
			jsonObject.put("ctrNm",managerCtrNm);
			jsonObject.put("ctrTel",managerCtrTel);
			return jsonObject;
		}else{
			return jsonObject;
		}
	}

	/**
	 * 根据供应商ID查询供应商厂商信息
	 * 
	 * @param request
	 * @return
	 * @throws Exception
	 */
	@RequestMapping(value = "/getSplMfrBySplId.do", method = { RequestMethod.GET})
	@ResponseBody
	public Object getSplMfrBySplId(HttpServletRequest request, HttpServletResponse response) throws BaseException {
		String splId = request.getParameter("splId");//供应商ID
		// 状态的集合
		String audStsCdStr = request.getParameter("audStsCdList");
		DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES, "获取成功");
		ListPageVO<MfrInfoVO> listPage = null;
		try {
			//查询供应商账号信息
			if(StringUtils.isBlank(splId)){
				result.setSuccess(BaseConstant.IS_YESNO_NO);
				result.setInfo("供应商ID为空！");
				return result;
			}
			List<String> audStsCdList = new ArrayList<String>();
			JSONArray audStsArray = JSONArray.fromObject(audStsCdStr);
			for (Object object : audStsArray) {
				audStsCdList.add(object.toString());
			}
			SplInfoQueryCondition condition = new SplInfoQueryCondition();
			// 供应商id
			condition.setId(Long.valueOf(splId));
			// 供应商所属厂商的状态集合
			condition.setAudStsCdList(audStsCdList);
			// 厂商必须有效
			condition.setIsValid(1);
			List<MfrInfoVO> splMfrList = this.prjPrdBscInfoService.getSplMfrListBySplId(condition);
			if(CollectionUtils.isEmpty(splMfrList)){
				result.setSuccess(BaseConstant.IS_YESNO_NO);
				result.setInfo("数据不存在！");
			}
			 listPage = new ListPageVO<MfrInfoVO>((List<MfrInfoVO>) splMfrList, splMfrList.size());
			result.setData(splMfrList);
		}catch(BaseException ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(ex.getMessage());
			logger.error(ex.getMessage(), ex);
		}catch(Exception ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo("获取数据失败！");
			logger.error("获取数据失败！", ex);
		}
		return listPage;
	}


	/**
	 * @Author liumengmeng
	 * @Description 批量处理--验车方式和出厂日期
	 * @Date 16:10 2019/12/19
	 * @Param []
	 * @return cmm.mid.core.framework.page.DataResultVO
	 **/
	@RequestMapping(value = "/modifyVehCheckCode.do", method = { RequestMethod.POST })
	@ResponseBody
	public DataResultVO ModifyVehCheckCode(){
		int i = prjPrdBscInfoService.modifyVehCheckCode();
		DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES,
				SysLogConstant.LOG_CMM_UPDATE_SUCC);
		result.setData(i);
		return result;
	}

	/**
	 * 删除数据
	 */
	@RequestMapping(value = "/removeByHC.do", method = {RequestMethod.POST })
	@ResponseBody
	public DataResultVO removeByHC(HttpServletRequest request, HttpServletResponse response) throws BaseException {
		String id = request.getParameter("prjPrdId");
		String paySchId = request.getParameter("paySchId");
		String prjId = request.getParameter("prjId");
		BaseLogUtils.newLogger("removeByHC删除项目产品.Start.prjPrdId:{},usrNm:{}", id, CurrentThreadContext.getCurrentUserName()).info();
		DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES, SysLogConstant.LOG_CMM_DELETE_SUCC);
		if (StringUtils.isEmpty(id) || StringUtils.isEmpty(paySchId) || StringUtils.isEmpty(prjId)) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_DATA_PK_IS_EMPTY);
			return result;
		}
		try {
			boolean flag = this.prjPrdBscInfoService.removePrjPrdByHC(Long.valueOf(id), Long.valueOf(paySchId), Long.valueOf(prjId));
			BaseLogUtils.newLogger("removeByHC删除项目产品.End.prjPrdId:{},flag:{},usrNm:{}", id, flag, CurrentThreadContext.getCurrentUserName()).info();
		} catch (BaseException ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(ex.getMessage());
			BaseLogUtils.newLogger("removeByHC删除项目产品失败.prjPrdId:{},usrNm:{}", id, CurrentThreadContext.getCurrentUserName()).setThrowable(ex).error(LogExceptionEnum.COMMON_CODE_0099);
		} catch (Exception ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_SYS_ERROR);
			BaseLogUtils.newLogger("removeByHC删除项目产品失败==prjPrdId:{},usrNm:{}", id, CurrentThreadContext.getCurrentUserName()).setThrowable(ex).error(LogExceptionEnum.COMMON_CODE_0099);
		}
		result.setSuccess(BaseConstant.IS_YESNO_YES);
		return result;
	}
}

